﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Hopscotch.Presentation.Common
{
    /// <summary>
    /// Base class for items that support property notification.
    /// </summary>
    public class PropertyNotificationObject : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// RaisePropertyChanged
        /// </summary>
        /// <param name="propertyName">Property Name</param>
        protected virtual void RaisePropertyChanged([CallerMemberName] string propertyName = "")
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
